0

ProjectAnalisismDataSederhana.ipynb

No Headings

The table of contents shows headings in notebooks and supported files.

Skip to Main
Jupyter

ProjectAnalisismDataSederhana

Last Checkpoint: 1 minute ago
  • File
  • Edit
  • View
  • Run
  • Kernel
  • Settings
  • Help
JupyterLab
Python [conda env:anaconda3]
Kernel status: Idle
image/svg+xml
    #Project Data Siswa
    Sampel 1000 data Siswa, beragam memiliki 10 kolom

    Usia:18-70 : Pendapatan:loc,scale : Skor pembelajaan:1,100 : Lama bekerja:0,20 : Jumlah pembelian:lam=3 : Jumlah keluhan:n=5,p=0.1 : Jenis
    kelamin:Pria,wanita,lainnya : Kategori kota: Kota besar,pinggiran,Desa : Level keanggotaan:Perunggu,perak,emas,plantinum : Berlangganan newsletter: 0,1

    #Project Data Siswa Sampel 1000 data Siswa, beragam memiliki 10 kolom

    Usia:18-70 : Pendapatan:loc,scale : Skor pembelajaan:1,100 : Lama bekerja:0,20 : Jumlah pembelian:lam=3 : Jumlah keluhan:n=5,p=0.1 : Jenis kelamin:Pria,wanita,lainnya : Kategori kota: Kota besar,pinggiran,Desa : Level keanggotaan:Perunggu,perak,emas,plantinum : Berlangganan newsletter: 0,1

    [34]:
    import pandas as pd
    import numpy as np

    def buat_data_sampel(jumlah_baris=1000):
    np.random.seed(42)

    # Fitur numerik kontinu
    usia = np.random.randint(18, 70, size=jumlah_baris)
    pendapatan = np.random.normal(loc=50000, scale=15000, size=jumlah_baris).astype(int)
    skor_pembelanjaan = np.random.uniform(1, 100, size=jumlah_baris)
    lama_bekerja = np.random.randint(0, 20, size=jumlah_baris)

    #Fitur numerik diskret
    jumlah_pembelian = np.random.poisson(lam=3, size=jumlah_baris)
    jumlah_keluhan = np.random.binomial(n=5, p=0.1, size=jumlah_baris)

    #Fitur kategorikal
    jenis_kelamin = np.random.choice(['Pria', 'Wanita', 'Lainnya'], size=jumlah_baris, p=[0.48, 0.48, 0.04])
    kategori_kota = np.random.choice(['Kota Besar', 'Pinggiran', 'Desa'], size=jumlah_baris, p=[0.5, 0.3, 0.2])
    level_keanggotaan = np.random.choice(['Perunggu', 'Perak', 'Emas', 'Plantinum'], size=jumlah_baris, p=[0.4, 0.3, 0.2, 0.1])

    #Fitur biner
    berlangganan_newsletter = np.random.choice([0, 1], size=jumlah_baris, p=[0.6, 0.4])

    #Variabel target - klasifikasi biner
    target = ((skor_pembelanjaan > 75) & (jumlah_pembelian > 2)).astype(int)

    df = pd.DataFrame({
    'Usia': usia,
    'Pendapatan': pendapatan,
    'SkorPembelajaan': skor_pembelanjaan,
    'LamaBekerja': lama_bekerja,
    'JumlahPembelian': jumlah_pembelian,
    'JumlahKeluhan': jumlah_keluhan,
    'JenisKelamin': jenis_kelamin,
    'KategoriKota': kategori_kota,
    Pratinjau data sampel:
       Usia  Pendapatan  SkorPembelajaan  LamaBekerja  JumlahPembelian  \
    0    56       25903        99.637099           14                5   
    1    69       53051        37.462644            3                3   
    2    46       38654        45.412452           11                6   
    3    32       28666        72.485023            5                2   
    4    60       40301        88.733382           18                4   
    
       JumlahKeluhan JenisKelamin KategoriKota LevelKeanggotaan  \
    0              0       Wanita    Pinggiran         Perunggu   
    1              1       Wanita         Desa         Perunggu   
    2              1       Wanita    Pinggiran         Perunggu   
    3              0       Wanita         Desa             Emas   
    4              0       Wanita         Desa         Perunggu   
    
       BerlanggananNewsletter  Target  
    0                       0       1  
    1                       1       0  
    2                       0       0  
    3                       0       0  
    4                       0       1  
    
    Nama kolom dalam DataFrame:
    ['Usia', 'Pendapatan', 'SkorPembelajaan', 'LamaBekerja', 'JumlahPembelian', 'JumlahKeluhan', 'JenisKelamin', 'KategoriKota', 'LevelKeanggotaan', 'BerlanggananNewsletter', 'Target']
    === Ringkasan Statistik Sedehana ===
    
    Ringkasan Kolom Numerik:
                 Usia    Pendapatan  SkorPembelajaan  LamaBekerja  \
    count  1000.00000   1000.000000      1000.000000  1000.000000   
    mean     43.81900  50863.121000        50.089569     9.873000   
    std      14.99103  14823.257362        28.659070     5.752387   
    min      18.00000   6556.000000         1.001152     0.000000   
    25%      31.00000  40822.250000        26.673211     5.000000   
    50%      44.00000  50807.000000        49.827353    10.000000   
    75%      56.00000  60281.750000        75.436941    15.000000   
    max      69.00000  89485.000000        99.836404    19.000000   
    
           JumlahPembelian  JumlahKeluhan  BerlanggananNewsletter       Target  
    count       1000.00000    1000.000000             1000.000000  1000.000000  
    mean           2.95800       0.516000                0.415000     0.145000  
    std            1.73414       0.691536                0.492969     0.352277  
    min            0.00000       0.000000                0.000000     0.000000  
    25%            2.00000       0.000000                0.000000     0.000000  
    50%            3.00000       0.000000                0.000000     0.000000  
    75%            4.00000       1.000000                1.000000     0.000000  
    max           10.00000       4.000000                1.000000     1.000000  
    
    Ringkasan Kolom Kategorikal:
    
    Kolom: JenisKelamin
    JenisKelamin
    Wanita     483
    Pria       483
    Lainnya     34
    Name: count, dtype: int64
    JenisKelamin
    Wanita     0.483
    Pria       0.483
    Lainnya    0.034
    Name: proportion, dtype: float64
    
    Kolom: KategoriKota
    KategoriKota
    Kota Besar    501
    Pinggiran     304
    Desa          195
    Name: count, dtype: int64
    KategoriKota
    Kota Besar    0.501
    Pinggiran     0.304
    Desa          0.195
    Name: proportion, dtype: float64
    
    Kolom: LevelKeanggotaan
    LevelKeanggotaan
    Perunggu     414
    Perak        293
    Emas         198
    Plantinum     95
    Name: count, dtype: int64
    LevelKeanggotaan
    Perunggu     0.414
    Perak        0.293
    Emas         0.198
    Plantinum    0.095
    Name: proportion, dtype: float64
    
    Kolom: BerlanggananNewsletter
    BerlanggananNewsletter
    0    585
    1    415
    Name: count, dtype: int64
    BerlanggananNewsletter
    0    0.585
    1    0.415
    Name: proportion, dtype: float64
    
    Kolom: Target
    Target
    0    855
    1    145
    Name: count, dtype: int64
    Target
    0    0.855
    1    0.145
    Name: proportion, dtype: float64
    
    [ ]:

    Common Tools
    No metadata.
    Advanced Tools
    No metadata.
    Anaconda Assistant
    AI-powered coding, insights and debugging in your notebooks.
    To enable the following extensions, create an account or sign in.
    • Anaconda Assistant
      4.1.0
    • Coming soon!
    • Data Catalogs
    • Panel Deployments
    • Sharing
    Already have an account? Sign In
    For more information, read our Anaconda Assistant documentation.
    Alt+[
    Alt+]
    Alt+End
    • Assistant
    • Open Anaconda Assistant
      Ctrl+Shift+A
    • Console
    • Change Kernel…
    • Clear Console Cells
    • Close and Shut Down…
    • Insert Line Break
    • Interrupt Kernel
    • New Console
    • Restart Kernel…
    • Run Cell (forced)
    • Run Cell (unforced)
    • Show All Kernel Activity
    • Display Languages
    • English
      English
    • File Operations
    • Autosave Documents
    • Download
      Download the file to your computer
    • Reload Notebook from Disk
      Reload contents from disk
    • Revert Notebook to Checkpoint…
      Revert contents to previous checkpoint
    • Save Notebook
      Save and create checkpoint
      Ctrl+S
    • Save Notebook As…
      Save with new path
      Ctrl+Shift+S
    • Trust HTML File
      Whether the HTML file is trusted. Trusting the file allows scripts to run in it, which may result in security risks. Only enable for files you trust.
    • Help
    • About Jupyter Notebook
    • Jupyter Reference
    • JupyterLab FAQ
    • JupyterLab Reference
    • Launch Jupyter Notebook File Browser
    • Markdown Reference
    • Show Keyboard Shortcuts…
      Show relevant keyboard shortcuts for the current active widget
      Ctrl+Shift+H
    • Image Viewer
    • Flip image horizontally
      H
    • Flip image vertically
      V
    • Invert Colors
      I
    • Reset Image
      0
    • Rotate Clockwise
      ]
    • Rotate Counterclockwise
      [
    • Zoom In
      =
    • Zoom Out
      -
    • Kernel Operations
    • Shut Down All Kernels…
    • Main Area
    • Close All Other Tabs
    • Close Tab
      Alt+W
    • Close Tabs to Right
    • End Search
      Esc
    • Find Next
      Ctrl+G
    • Find Previous
      Ctrl+Shift+G
    • Find…
      Ctrl+F
    • Log Out
      Log out of Jupyter Notebook
    • Search in Selection
      Alt+L
    • Shut Down
      Shut down Jupyter Notebook
    • Mode
    • Toggle Zen Mode
    • Notebook Cell Operations
    • Change to Code Cell Type
      Y
    • Change to Heading 1
      1
    • Change to Heading 2
      2
    • Change to Heading 3
      3
    • Change to Heading 4
      4
    • Change to Heading 5
      5
    • Change to Heading 6
      6
    • Change to Markdown Cell Type
      M
    • Change to Raw Cell Type
      R
    • Clear Cell Output
      Clear outputs for the selected cells
    • Collapse All Code
    • Collapse All Outputs
    • Collapse Selected Code
    • Collapse Selected Outputs
    • Copy Cell
      Copy this cell
      C
    • Cut Cell
      Cut this cell
      X
    • Delete Cell
      Delete this cell
      D, D
    • Disable Scrolling for Outputs
    • Enable Scrolling for Outputs
    • Expand All Code
    • Expand All Outputs
    • Expand Selected Code
    • Expand Selected Outputs
    • Extend Selection Above
      Shift+K
    • Extend Selection Below
      Shift+J
    • Extend Selection to Bottom
      Shift+End
    • Extend Selection to Top
      Shift+Home
    • Insert Cell Above
      Insert a cell above
      A
    • Insert Cell Below
      Insert a cell below
      B
    • Insert Heading Above Current Heading
      Shift+A
    • Insert Heading Below Current Heading
      Shift+B
    • Merge Cell Above
      Ctrl+Backspace
    • Merge Cell Below
      Ctrl+Shift+M
    • Merge Selected Cells
      Shift+M
    • Move Cell Down
      Move this cell down
      Ctrl+Shift+Down
    • Move Cell Up
      Move this cell up
      Ctrl+Shift+Up
    • Paste Cell Above
      Paste this cell from the clipboard
    • Paste Cell and Replace
    • Paste Cell Below
      Paste this cell from the clipboard
      V
    • Redo Cell Operation
      Shift+Z
    • Render Side-by-Side
      Shift+R
    • Run Selected Cell
      Run this cell and advance
      Shift+Enter
    • Run Selected Cell and Do not Advance
      Ctrl+Enter
    • Run Selected Cell and Insert Below
      Alt+Enter
    • Run Selected Text or Current Line in Console
    • Select Cell Above
      K
    • Select Cell Below
      J
    • Select Heading Above or Collapse Heading
      Left
    • Select Heading Below or Expand Heading
      Right
    • Set side-by-side ratio
    • Split Cell
      Ctrl+Shift+-
    • Undo Cell Operation
      Z
    • Notebook Operations
    • Access Next Kernel History Entry
      Alt+Down
    • Access Previous Kernel History Entry
      Alt+Up
    • Change Kernel…
    • Clear Outputs of All Cells
      Clear all outputs of all cells
    • Close and Shut Down Notebook…
    • Collapse All Headings
      Ctrl+Shift+Left
    • Deselect All Cells
    • Edit Notebook Metadata
    • Enter Command Mode
      Ctrl+M
    • Enter Edit Mode
      Enter
    • Expand All Headings
      Ctrl+Shift+Right
    • Interrupt Kernel
      Interrupt the kernel
    • New Console for Notebook
    • New Notebook
      Create a new notebook
    • Open with Panel in New Browser Tab
    • Preview Notebook with Panel
    • Reconnect to Kernel
    • Render All Markdown Cells
    • Restart Kernel and Clear Outputs of All Cells…
      Restart the kernel and clear all outputs of all cells
    • Restart Kernel and Debug…
      Restart Kernel and Debug…
    • Restart Kernel and Run All Cells…
      Restart the kernel and run all cells
    • Restart Kernel and Run up to Selected Cell…
    • Restart Kernel…
      Restart the kernel
    • Run All Above Selected Cell
    • Run All Cells
      Run all cells
    • Run Selected Cell and All Below
    • Save and Export Notebook: Asciidoc
    • Save and Export Notebook: Executable Script
    • Save and Export Notebook: HTML
    • Save and Export Notebook: LaTeX
    • Save and Export Notebook: Markdown
    • Save and Export Notebook: PDF
    • Save and Export Notebook: Qtpdf
    • Save and Export Notebook: Qtpng
    • Save and Export Notebook: ReStructured Text
    • Save and Export Notebook: Reveal.js Slides
    • Save and Export Notebook: Webpdf
    • Select All Cells
      Ctrl+A
    • Show Line Numbers
    • Toggle Collapse Notebook Heading
    • Trust Notebook
    • Other
    • Open in JupyterLab
      JupyterLab
    • Plugin Manager
    • Advanced Plugin Manager
    • Terminal
    • Decrease Terminal Font Size
    • Increase Terminal Font Size
    • New Terminal
      Start a new terminal session
    • Refresh Terminal
      Refresh the current terminal session
    • Use Terminal Theme: Dark
      Set the terminal theme
    • Use Terminal Theme: Inherit
      Set the terminal theme
    • Use Terminal Theme: Light
      Set the terminal theme
    • Text Editor
    • Decrease Font Size
    • Increase Font Size
    • New Markdown File
      Create a new markdown file
    • New Python File
      Create a new Python file
    • New Text File
      Create a new text file
    • Spaces: 1
    • Spaces: 2
    • Spaces: 4
    • Spaces: 4
    • Spaces: 8
    • Theme
    • Decrease Code Font Size
    • Decrease Content Font Size
    • Decrease UI Font Size
    • Increase Code Font Size
    • Increase Content Font Size
    • Increase UI Font Size
    • Set Preferred Dark Theme: JupyterLab Dark
    • Set Preferred Dark Theme: JupyterLab Dark High Contrast
    • Set Preferred Dark Theme: JupyterLab Light
    • Set Preferred Light Theme: JupyterLab Dark
    • Set Preferred Light Theme: JupyterLab Dark High Contrast
    • Set Preferred Light Theme: JupyterLab Light
    • Synchronize Styling Theme with System Settings
    • Theme Scrollbars
    • Use Theme: JupyterLab Dark
    • Use Theme: JupyterLab Dark High Contrast
    • Use Theme: JupyterLab Light
    • View
    • File Browser
    • Open JupyterLab
    • Show Anaconda Assistant
      Show Show Anaconda Assistant in the right sidebar
    • Show Header
    • Show Notebook Tools
      Show Show Notebook Tools in the right sidebar
    • Show Table of Contents
      Show Show Table of Contents in the left sidebar